package com.ftqh.tutorial.api.v1;

import com.ftqh.tutorial.security.entity.User;
import com.ftqh.tutorial.security.repository.UserRepository;
import org.springframework.stereotype.Service;

import java.util.Optional;

@Service
public class UserServiceV1 {

    private UserRepository userRepository;

    public UserServiceV1(UserRepository userRepository) {
        this.userRepository = userRepository;
    }

    //@HystrixCommand
    public Optional<User> getUserByUsername(String username) {
        return userRepository.findByUsername(username);
    }
}
